home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Programming / LEDA / prog / graphics / zoom.c < prev   
C/C++ Source or Header  |  1994-08-05  |  625b  |  42 lines

  1. #include <LEDA/plane.h>
  2. #include <LEDA/window.h>
  3.  
  4. main()
  5. {
  6.   window W;
  7.   W.init(-100000000, 100000000, -100000000);
  8.  
  9.   int n =  W.read_int("n = ");
  10.  
  11.   list<segment> L;
  12.  
  13.   point c(0,0);
  14.   segment s;
  15.  
  16.   double r = 1000000000;
  17.   double alpha = 0;
  18.   double d = 2*M_PI/n;
  19.  
  20.   for(int i = 0; i<n; i++)
  21.   { point p(random(-10,+10),random(-10,+10));
  22.     s = segment(p,c.translate(alpha,r));
  23.     L.append(s);
  24.     alpha += d;
  25.    }
  26.  
  27.   forall(s,L) W << s;
  28.  
  29.   point p,q;
  30.  
  31.   for(;;)
  32.   { if (W.read_mouse(p)==3) break;
  33.     W.read_mouse_rect(p,q);
  34.     W.init(p.xcoord(),q.xcoord(),p.ycoord());
  35.     forall(s,L) W << s;
  36.   }
  37.  
  38.  
  39.   return 0;
  40. }
  41.   
  42.